package com.sprucetec.live.controller;

import com.sprucetec.live.common.util.OssUtil;
import com.sprucetec.live.common.util.ServiceResult;
import com.sprucetec.live.common.util.ServiceResultUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName RestController
 * @Description:
 * @Author Kenny
 * @Date 2020/5/25
 **/
@RestController
@Slf4j
@RequestMapping(value = "/rest")
public class RestfulController {

    @CrossOrigin  //*  可以改成ip地址
    @GetMapping("getMapRuleIp")
    public ServiceResult getMapRuleIp(HttpServletRequest request) {
        log.info("getMapRuleIp获取到的IP" + OssUtil.getRealIp(request));
        return ServiceResultUtil.success(OssUtil.getRealIp(request));
    }
}
